#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: init.py 
@version:
@time: 2022/05/10 
"""
from TapClientCore.T01_init_conf.path_conf import PathConf
from TapClientCore.mongo_for_api import MongoForApi
from TapUtil.operatefile.use_yaml import read_yaml

init_config = read_yaml(PathConf.YML)
serve_template = read_yaml(PathConf.SERVE_TEMPLATE)

# collection
collection_name = init_config.get('CollectionName')
serve_collection = collection_name.get('Serve')
datasource_collection = collection_name.get('DataSources')
dataflow_collection = collection_name.get('DataFlows')
task_collection = collection_name.get('Task')
parallel_record_collection = collection_name.get('ParallelRecord')
inspects_collection = collection_name.get('InspectsCollection')
# case setting
case_setting = init_config.get('CaseSetting')
requests_retime = case_setting.get('requests_retime')
rerun = case_setting.get('rerun')
interval = case_setting.get('interval')
timeout_config = case_setting.get('timeout')
# agent linux info
linux_info = init_config.get('agent_linux_info')
# Debug info
debug = init_config.get('Debug')
is_use = debug.get('use')
is_method = debug.get('method')
is_url = debug.get('url')
is_header = debug.get('header')
is_payload = debug.get('payload')
is_response = debug.get('response')
# db info
mongodb_setting = init_config.get('MongoDBSetting').get('cloud')
MFA = MongoForApi(mongodb_setting)
